﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GeoLocationServiceProxies.Services;
using GeoLocationServiceProxies.Properties;

namespace GeoLocationServiceProxies.GeocodeService
{
    public class GeocodeServiceProxy : ServiceProxy<IGeocodeService>, IGeocodeServiceProxy
    {
        public GeocodeServiceProxy()
            : base(new GeocodeServiceClient())
        {
        }

        public GeocodeResponse1 Geocode(GeocodeRequest1 request)
        {
            request.request.Credentials = new Credentials() { ApplicationId = Settings.Default.GeocodeCredentials };
            return Service.Geocode(request);
        }

        public IAsyncResult BeginGeocode(GeocodeRequest1 request, AsyncCallback callback, object asyncState)
        {
            request.request.Credentials = new Credentials() { ApplicationId = Settings.Default.GeocodeCredentials };
            return Service.BeginGeocode(request, callback, asyncState);
        }

        public GeocodeResponse1 EndGeocode(IAsyncResult result)
        {
            return Service.EndGeocode(result);
        }

        public ReverseGeocodeResponse ReverseGeocode(ReverseGeocodeRequest1 request)
        {
            request.request.Credentials = new Credentials() { ApplicationId = Settings.Default.GeocodeCredentials };
            return Service.ReverseGeocode(request);
        }

        public IAsyncResult BeginReverseGeocode(ReverseGeocodeRequest1 request, AsyncCallback callback, object asyncState)
        {
            request.request.Credentials = new Credentials() { ApplicationId = Settings.Default.GeocodeCredentials };
            return Service.BeginReverseGeocode(request, callback, asyncState);
        }

        public ReverseGeocodeResponse EndReverseGeocode(IAsyncResult result)
        {
            return Service.EndReverseGeocode(result);
        }
    }
}
